<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<script type="text/javascript">
<!--
var setGoodsDataPaginator;
function doRefresh(){
var sGoodId=$("#sGoodId").val(), sCategoryonid = $("#sCategoryonid").val(), sCategorytwid = $("#sCategorytwid").val(),sSellerId = $("#sSellerId").val(),sStoreId = $("#sStoreId").val();
  k = $("#keyword").val();
	if(setGoodsDataPaginator){
		setGoodsDataPaginator.destroy();
	}
	setGoodsDataPaginator = Kit.pagination("#setGoodsDataPagination","${BASE_PATH}/bus/goods/baby/goodsPage",{k:k,sGoodId:sGoodId,sCategoryonid:sCategoryonid,sCategorytwid:sCategorytwid,sSellerId:sSellerId,sStoreId:sStoreId,"pageSize":10},function(result){
		$("#setGoodsDataList").empty().append(template("setGoodsDataTpl",result.object));
	});
}
function doSetGoods(id,title,thumb){
	onGoodsChoosed(id,title,thumb);
	setGoodsDialog.close();
}
//-->
</script>
<script type="text/html" id="setGoodsDataTpl">
	{{each list as item}}
	<tr id="item{{item.id}}" data-id="{{item.id}}">
		<td>{{item.name}}</td>
		<td><button type="button" class="btn btn-sm btn-primary" onclick="doSetGoods('{{item.id}}','{{item.name}}','{{item.thumb}}')" title="选择">选择</button></td>
	</tr>
	{{/each}}
</script>
<div class="row">
	<div class="col-lg-12">
		<label class="search-label">选择公司：</label>
		<select id="sSellerId" class="selectpicker pull-left p-l-5"  data-width="10%" data-url="${BASE_PATH}/api/sellerAllState" data-isfirst="true" data-next="#sStoreId" data-key="sellerId:sellerName"></select>
		<label class="search-label">选择分公司：</label>
		<select id="sStoreId" class="selectpicker pull-left p-l-5" data-width="10%" data-url="${BASE_PATH}/api/storeState/{value}"  data-key="storeid:title"></select>
		<label class="search-label">分类：</label>
   		<select id="sCategoryonid" name="sCategoryonid" class="selectpicker" data-width="10%" data-url="${BASE_PATH}/api/category" data-isfirst="true" data-next="#sCategorytwid" data-key="id:name"></select>
		<select id="sCategorytwid" name="sCategorytwid" class="selectpicker" data-width="10%" data-url="${BASE_PATH}/api/categorys/{value}"  data-key="id:name"></select>			
		<div class="clearfix"></div>
		 <label class="search-label">商品编号：</label><input type="text" id="sGoodId" value="" class="form-control search-input width200" maxlength="21">
		<input type="text" id="keyword" value="" class="form-control pull-left m-l-5 width200" placeholder="搜索关键字" maxlength="100">
		<button type="button" class="btn btn-success pull-left m-l-5" onclick="doRefresh()">查询</button>
	</div>
</div>
<div class="row">
	<div class="col-lg-12" style="min-height:300px;">
		<div class="table-responsive">
			<table class="table table-striped table-hover">
	            <thead>
	                <tr>
	                    <th width="85%">商品名称</th>
	                    <th width="15%">操作</th>
	                </tr>
	            </thead>
	            <tbody id="setGoodsDataList"></tbody>
	        </table>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-lg-12">
		<ul id="setGoodsDataPagination" class="pagination-sm pull-right"></ul>
	</div>
</div>